#!/bin/bash

script_dir=$(dirname $(realpath $0))
source "${script_dir}/config"

qemu-system-arm \
	-M vexpress-a9 \
    -kernel "${uboot}/u-boot" \
	-append "root=/dev/mmcblk0 rw console=ttyAMA0" \
	-sd "${tmpdir}/u-boot.img" \
	-nographic 

#进入uboot命令行，切换mmc dev号
# mmc dev 0
# #从SD分区load zImage和dtb

# load mmc 0:1 0x60008000 zImage  
# load mmc 0:1 0x67008000 vexpress-v2p-ca9.dtb  

# #设置内核启动参数
# setenv bootargs 'root=/dev/mmcblk0p2 rw rootfstype=ext4 console=ttyAMA0'
# setenv bootargs 'root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon console=tty0 console=ttyAMA0 init=/linuxrc ignore_loglevel'

# #启动内核
# bootz 0x60008000 - 0x67008000
